<template>
	<view>
		<view class="d-flex flex-column a-center pt-3">
			<!-- <navigator url="joinactivitylist" class="head-activity">我参与的活动</navigator> -->
			<FacInfoModify @factory_info="factory_info" :factory_info_data="factory_info_data" :factory_id="factory_id" :modify="modify" :scrollH="scrollH"/>
		</view>

		<facInfo :factory_info_data="factory_info_data" class="pl-5 pr-5 line-h-md" />

		<fac-tab-bar :pagePath="'/pages/factory/my'" :factory_id="factory_id" :activity_id="activity_id" />

	</view>
</template>

<script>
	import facTabBar from '../../components/factory/fac_tabbar.vue'
	export default {
		components: {
			facTabBar
		},
		data() {
			return {
				scrollH: 100,
				factory_id: 0,
				activity_id: '',
				factory_info_data: {},
				modify: {
					boss_name: '',
					boss_tel: '',
					name: '',
					address: '',
					phone: '',
					head_url: '',
					code_url: ''
				},
			};
		},
		onLoad(e) {
			this.activity_id = e.activity_id
			this.$comm.appLogin(user_info=>{
				this.factory_info()
				this.get_scrollH()
			})
		},
		methods: {
			//获取商家信息
			factory_info(id) {
				var id = this.activity_id;
				// console.log(this.$comm.app_config.share_url)
				this.$comm.request({
					url: 'api/my_factory_info?activity_id=' + id,
					method: 'GET',
					data: {
						activity_id: id
					},
					success: res => {
						this.factory_id = res.data.result.id;
						console.log(res, '商家信息',this.factory_id);
						this.factory_info_data = res.data.result;
						this.modify.boss_name = res.data.result.boss_name;
						this.modify.boss_tel = res.data.result.boss_tel;
						this.modify.name = res.data.result.name;
						this.modify.phone = res.data.result.tel;
						this.modify.address = res.data.result.address;
						this.modify.head_url = res.data.result.head_url;
						this.modify.code_url = res.data.result.code_url;
					}
				});
			},
			//获取可视区域高度
			get_scrollH() {
				uni.getSystemInfo({
					success: (res) => {
						this.scrollH = res.windowHeight - uni.upx2px(270)
						// console.log(res.windowHeight, '可视区域高度',this.scrollH)
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/common/main.css';
	@import  '@/common/zcm-main.css';
	
	page {
		font-size: 30rpx;
	}
	
	.invitetitle {
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 20rpx 0 10rpx 50rpx;
		
		.invitetitle-em {
			height: 35rpx;
			width: 10rpx;
			background-color: #475dfc;
			border-radius: 50rpx;
		}
	
		.invitetitle-text {
			margin-left: 10rpx;
		}
	}

	.head-activity {
		color: #ffffff;
		line-height: 2.5;
		background-color: #475dfc;
		width: 400rpx;
		text-align: center;
		border-radius: 50rpx;
	}
</style>
